home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The CDPD Public Domain Collection for CDTV 4
/
CDPD_IV.bin
/
e
/
mailinglists
/
amigae.0294feb.archive
/
000094_donews!crash!fr…leton.ca!ao443_Thu, 24 Feb 94 01:11:57 PST.msg
< prev
next >
Wrap
Internet Message Format
|
1994-05-26
|
5KB
Received: by bkhouse.cts.com (V1.17-beta/Amiga)
id <1wgy@bkhouse.cts.com>; Thu, 24 Feb 94 01:11:57 PST
Received: from crash by donews.cts.com with uucp
(Smail3.1.28.1 #18) id m0pZNSy-0001TUC; Wed, 23 Feb 94 12:33 EST
Received: from freenet-news.carleton.ca by crash.cts.com with smtp
(Smail3.1.28.1 #18) id m0pZN8Z-0000V9C; Wed, 23 Feb 94 09:12 PST
Received: from freenet.carleton.ca by freenet-news.carleton.ca (4.1/SMI-4.0)
id AA06775; Wed, 23 Feb 94 12:13:04 EST
Received: from localhost (ao443@localhost) by freenet.carleton.ca (8.6.4/8.6.4) id MAA09588; Wed, 23 Feb 1994 12:12:26 -0500
Date: Wed, 23 Feb 1994 12:12:26 -0500
Message-Id: <199402231712.MAA09588@freenet.carleton.ca>
Reply-To: ao443@freenet.carleton.ca
From: ao443@freenet.carleton.ca (Jason Maskell)
To: amigae@bkhouse.cts.com
Subject: Problem IFFParse code.
Well, here is the program that I told you people about. Take it
home, nurture it, see if you can get it to straighten up and fly right. If
it works when you compile it (as it should), then something is wrong with
my iffparse library.
/*
ILBM brush to Image.
*/
MODULE 'dos/dos','intuition/intuition','asl','libraries/asl',
'libraries/iffparse','iffparse','utility/tagitem'
ENUM NOERROR,ER_LIBRARY,ER_NOMEM,ER_NOASLREQUEST,ER_FILENOTFOUND,ER_IFFERROR,
ER_NOBMHD
CONST ID_ILBM=$494C424D
CONST ID_BMHD=$424D4844
CONST ID_BODY=$424F4459
CONST ID_CMAP=$434D4150
DEF iff:PTR TO iffhandle
PROC main()
DEF req:PTR TO filerequestr,source[256]:STRING,err,xsize,ysize,depth,bmhd,
body,cmap,camg,cflag,p:PTR TO INT,bp:PTR TO CHAR,sp:PTR TO storedproperty
IF KickVersion(37)=FALSE
WriteF('Sorry, Kickstart V37+ Required.\n')
getout(0)
ENDIF
IF (aslbase:=OpenLibrary('asl.library',37))=0
error(ER_LIBRARY,'asl')
ENDIF
IF (iffparsebase:=OpenLibrary('iffparse.library',37))=0
error(ER_LIBRARY,'iffparse')
ENDIF
IF (req:=AllocAslRequest(ASL_FILEREQUEST,[ASL_HAIL,'Choose ILBM to
convert',0]:tagitem))>0
IF AslRequest(req,0)=0
FreeAslRequest(req)
getout(0)
ELSE
StrCopy(source,req.dir,ALL) ;
AddPart(source,req.file,256) ; SetStr(source,StrLen(source))
ENDIF
ELSE
error(ER_NOASLREQUEST,0)
ENDIF
IF FileLength(source)>0
IF (iff:=AllocIFF())>0
iff.stream:=Open(source,MODE_OLDFILE)
InitIFFasDOS(iff)
IF (err:=OpenIFF(iff,IFFF_READ))=0
IF (err:=PropChunk(iff,"ILBM","BMHD"))=0
IF (err:=ParseIFF(iff,IFFPARSE_SCAN)=IFFERR_EOF)
IF (sp:=FindProp(iff,"ILBM","BMHD"))>0
bmhd:=sp.data
bp:=p:=bmhd ;
xsize:=p[2] ; ysize:=p[3]
depth:=bp[13] ; cflag:=bp[14]
ELSE
error(ER_NOBMHD,0)
ENDIF
WriteF('Start:\z\h[8]
Xsize:\d Ysize:\d Compression:\d Depth:\d\n',bmhd,xsize,ysize,cflag,depth)
getout(0)
ELSE
error(ER_IFFERROR,err)
ENDIF
ELSE
error(ER_IFFERROR,err)
ENDIF
ELSE
error(ER_IFFERROR,err)
ENDIF
ELSE
error(ER_IFFERROR,IFFERR_NOMEM)
ENDIF
ELSE
error(ER_FILENOTFOUND,source)
ENDIF
ENDPROC
CHAR '$VER: ILBM2Image v.01 (C) 1994 Jason Maskell',0
PROC getout(retcode)
IF iff
CloseIFF(iff)
Close(iff.stream)
FreeIFF(iff)
ENDIF
IF aslbase
CloseLibrary(aslbase)
ENDIF
IF iffparsebase
CloseLibrary(iffparsebase)
ENDIF
CleanUp(retcode)
ENDPROC
PROC error(errnum,str)
DEF work[80]:STRING
SELECT errnum
CASE ER_LIBRARY
StringF(work,'Could not open \s.library V37+',str)
CASE ER_NOMEM
StringF(work,'Unable to allocate memory.')
CASE ER_NOASLREQUEST
StringF(work,'Unable to allocate ASL requester.')
CASE ER_FILENOTFOUND
StringF(work,'File "\s" not found.',str)
CASE ER_IFFERROR
SELECT str
CASE IFFERR_EOC
StringF(work,'Iffparse Error: End
of Context')
CASE IFFERR_NOSCOPE
StringF(work,'Iffparse Error: No
valid scope')
CASE IFFERR_NOMEM
StringF(work,'Iffparse Error:
Internal Memory allocation failed.')
CASE IFFERR_READ
StringF(work,'Iffparse Error:
Stream Read Error.')
CASE IFFERR_WRITE
StringF(work,'Iffparse Error:
Stream Write Error.')
CASE IFFERR_SEEK
StringF(work,'Iffparse Error:
Stream Seek Error.')
CASE IFFERR_MANGLED
StringF(work,'Iffparse Error: IFF
file is corrupt.')
CASE IFFERR_SYNTAX
StringF(work,'Iffparse Error: IFF
Syntax Error.')
CASE IFFERR_NOTIFF
StringF(work,'Iffparse Error: Not
an IFF file.')
DEFAULT
StringF(work,'Iffparse Error:
Unknown Error code: \d',str)
ENDSELECT
CASE ER_NOBMHD
StringF(work,'No Bitmapheader found. Not a usable FORM')
DEFAULT
StringF(work,'Unknown Error code: \d',errnum)
ENDSELECT
request('ILBN2Image Error',work,'Ok',0)
getout(11)
ENDPROC
PROC request(title,body,gadgets,args)
ENDPROC EasyRequestArgs(0,[20,0,title,body,gadgets],0,args)
--
'You see son, if this were Star Trek, we'd be negotiating with this Kobold.'
- Unknown Angband Player